/**
 * 
 */
package cx3k.GUI;

import javax.swing.*;
import java.awt.*;
/**
 * @author Chris
 *
 */
public class FileFrame extends JFrame{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JFileChooser jfc;
	
	public FileFrame() {
		super();
		this.setSize(500, 300);
		this.jfc = new JFileChooser();
		
		//Center frame on screen
		Toolkit toolkit = this.getToolkit();
	    Dimension size = toolkit.getScreenSize();
	    this.setLocation(size.width/2 - getWidth()/2, size.height/2 - getHeight()/2);
	}
	
	public String getSaveLocation() {
		int val = jfc.showSaveDialog(this);
		if (val == JFileChooser.APPROVE_OPTION) {
			return jfc.getSelectedFile().getAbsolutePath();
		}
		else return null;
	}
	
	public String getOpenLocation() {
		int val = jfc.showOpenDialog(this);
		if (val == JFileChooser.APPROVE_OPTION) {
			return jfc.getSelectedFile().getAbsolutePath();
		}
		else return null;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	}

}
